import Vue from 'vue'
import Vuex from 'vuex'
import user from './module/user'
import app from './module/app'
import axios from '@/libs/api.request';
import path from '@/api/path.js';
Vue.use(Vuex)
let url = path.url;

export default new Vuex.Store({
  state: {
    userinfo: {},
		articleLabel: []
  },
  mutations: {
		// 获取用户详情
    getUserInfo(state, id){
			axios.request({
				url: `${url}user/getUserDetail`,
				method: 'post',
				data: {id}
			}).then(res => {
				 if ( res.status == 200 ) {
					 state.userinfo = res.data.content
				 } else {
					 throw res.msg
				 }
			})
		},
		// 获取装修圈标签列表
		getLabelList(state){
			axios.request({
				url: `${url}Article/getArticleCateList`,
				methods: 'post',
				}).then(res=>{
					if ( res.status == 200 ) {
						state.articleLabel = res.data.content.data
					} else {
						throw res.msg
					}
				})
		},
  },
  actions: {
  },
  modules: {
    user,
    app
  }
})
